package com.cmy.webCore.enums;

import com.cmy.webCore.utils.MessageUtil;
import com.cmy.webCore.vo.IResultCode;
import lombok.Getter;

/**
 * <p>
 * 通用状态枚举
 * </p>
 *
 * @author yangkai.shen
 * @date Created in 2019-03-22 10:13
 */
@Getter
public enum ResultCode implements IResultCode {
    /**
     * 成功
     */
    OK(200, "SUCCESS"),
    /**
     * 失败 后台错误
     */
    ERROR(500, "FAIL"),
    /**
     * 无权限
     */
    REFUSE(403,"UNAUTHORIZED"),
    /**
     * 未找到 url错误
     */
    UN_FIND(404,"NOT_FOUND"),
    /**
     * 错误的请求 参数错误
     */
    BAD_REQUEST(400,"BAD_REQUEST");

    /**
     * 返回码
     */
    private Integer code;

    /**
     * 返回消息
     */
    private String message;

    ResultCode(Integer code, String message) {
        this.code = code;
        this.message = MessageUtil.message(message);//加一层 反正没有key返回原来的key
    }

}
